<template>
  <!-- 计费与返还清单查询明细页面弹出框-->
  <el-dialog
    title="计费与返还清单查询明细"
    center
    :visible.sync="open"
    width="1024px"
    :close-on-click-modal="true"
    @close="closeFn"
  >
    <div class="print-content" ref="printContent">
      <el-form ref="detailsForm" :model="formData" label-width="180px" :disabled="true">
        <el-row>
          <el-col :span="12">
            <el-form-item label="系统流水号：" prop="id">
              <el-input v-model="formData.id" placeholder="系统流水号" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="报文标志号：" prop="pkgId">
              <el-input v-model="formData.pkgId" placeholder="报文标志号" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row type="flex">
          <el-col :span="12">
            <el-form-item label="工作日期：" prop="workdate">
              <el-date-picker
                v-model="formData.workdate"
                type="date"
                value-format="yyyyMMdd"
                placeholder="选择日期"
                style="width: 100%"
              ></el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="计费与返还类型：" prop="chgType">
              <el-select v-model="formData.chgType" placeholder="请选择" style="width: 100%">
                <el-option
                  v-for="dict in dictMap.CHARGETYPECODE"
                  :key="dict.value"
                  :label="`${dict.value}-${dict.text}`"
                  :value="dict.value"
                ></el-option>
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="计费直接参与者：" prop="chgPtcpt">
              <el-input v-model="formData.chgPtcpt" placeholder="计费直接参与者" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="计费直接参与者名称：" prop="chgPtcptName">
              <el-input v-model="formData.chgPtcptName" placeholder="计费直接参与者名称" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row type="flex">
          <el-col :span="12">
            <el-form-item label="计费/返还总金额币种：" prop="curcd">
              <el-input v-model="formData.curcd" placeholder="计费/返还总金额币种" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="计费/返还总金额：" prop="chgTotAmt">
              <el-input v-model="formData.chgTotAmt" placeholder="计费/返还总金额" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row type="flex">
          <el-col :span="12">
            <el-form-item label="计费开始日期：" prop="chgStartDate">
              <el-date-picker
                v-model="formData.chgStartDate"
                type="date"
                value-format="yyyyMMdd"
                placeholder="选择日期"
                style="width: 100%"
              ></el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="计费终止日期：" prop="chgEndDate">
              <el-date-picker
                v-model="formData.chgEndDate"
                type="date"
                value-format="yyyyMMdd"
                placeholder="选择日期"
                style="width: 100%"
              ></el-date-picker>
            </el-form-item>
          </el-col>
        </el-row>

        <el-row type="flex">
          <el-col :span="12">
            <el-form-item label="计费年月：" prop="chgMonth">
              <el-date-picker
                v-model="formData.chgMonth"
                type="month"
                value-format="yyyyMM"
                placeholder="选择年月"
                style="width: 100%"
              ></el-date-picker>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="计费业务系统数目：" prop="chgSysNum">
              <el-input v-model="formData.chgSysNum" placeholder="计费业务系统数目" />
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <div style="height: 300px; margin-bottom: 20px">
        <ht-table
          id="pagetable"
          ref="flowTable"
          :showSerialNumber="false"
          :multi-select="false"
          :dictMap="dictMap"
          :reqConfig="reqConfig"
          :queryParams="queryParams"
          :tableBindColumns="tableBindColumns"
          :opButtonList="opButtonList"
          :randomRowKey="true"
          :initData="false"
          defaultEventKey="flowTable"
          style="height: 100%"
        ></ht-table>
      </div>
    </div>
    <div slot="footer" class="dialog-footer">
      <el-button type="warning" @click="printFn">打印</el-button>
    </div>
  </el-dialog>
</template>
<script>
import { detailTabSearch } from "@/api/cnaps/saps/otherCommQuery/billing_list_query.js";
import { amountThousandsFormatter } from "@/utils/table_col_formatter";
export default {
  name: "BillingDetails",
  props: {
    dictMap: {
      type: Object,
      default: () => {
        return {};
      },
    },
    formData: {
      type: Object,
      default: () => {
        return {};
      },
    },
  },
  data() {
    return {
      // 是否显示弹出层
      open: false,
      reqConfig: detailTabSearch,
      // 查询参数
      queryParams: {
        id: "",
      },
      opButtonList: () => {
        return [];
      },
      tableBindColumns: [
        {
          label: `计费所属系统`,
          prop: "chgSys",
          align: "center",
          sortable: false,
          dictCode: "SYSTEMCODE",
        },
        {
          label: `货币币种`,
          prop: "curcd",
          align: "center",
          sortable: false,
        },
        {
          label: `计费/返还总金额`,
          prop: "chgAmt",
          align: "center",
          sortable: false,
          type: "price",
        },
      ],
    };
  },
  mounted() {},
  watch: {
    open(d) {
      if (d) {
        this.$nextTick(() => {
          if (this.formData && this.formData.id) {
            this.$set(this.queryParams, "id", this.formData.id);
            this.$refs.flowTable.doQuery();
          }
        });
      }
    },
  },
  methods: {
    // 表单重置
    reset() {
      this.resetForm("detailsForm");
      // this.$set(this, "form", {});
    },
    printFn() {
      this.$print(this.$refs["printContent"]);
    },
    closeFn() {
      this.open = false;
      this.reset();
    },
    show() {
      this.open = true;
    },
  },
};
</script>
<style lang="scss" scoped>
.label-header-msg {
  font-weight: bold;
}

.form-card {
  margin-bottom: 10px;
}

::v-deep table {
  table-layout: auto !important;
}
::v-deep .el-table__header-wrapper .el-table__header {
  width: 100% !important;
}
::v-deep .el-table__body-wrapper .el-table__body {
  width: 100% !important;
}
::v-deep #pagetable table {
  table-layout: fixed !important;
}
@page {
  size: 297mm 210mm;
  margin: 0;
}
@media print {
  ::-webkit-scrollbar {
    display: none;
  }
  .print-dialog {
    overflow: hidden !important;
  }
  .print-content {
    width: 1000px;
    margin: 50px auto;
    .app-container-footer {
      display: none;
    }
  }
  #pagetable {
    ::v-deep .app-container-footer {
      display: none !important;
    }
  }
}
</style>
